widgetpaintable: Protect against too many signals
authorBenjamin Otte <otte@redhat.com>
Sun, 1 Apr 2018 13:25:16 +0000 (15:25 +0200)
committerBenjamin Otte <otte@redhat.com>
Thu, 5 Apr 2018 12:56:39 +0000 (14:56 +0200)
commit12fedca726d42f2087ffc3c5621eeb6757265319
tree881137588c78e7c8fd33014e3b0ffbfa3fe94d26
parent139882bc7662d7afa77ac60f372e553274b1441c
widgetpaintable: Protect against too many signals

This is actually not just a mechnaism to protect against too many
signals, but it's also a method to getting those signals at the wrong
time.

For every size/content change, a widget needs to invalidate twice:
Once when it queues a resize/redraw (going valid => invalid) and once
when the new size/content is actually assigned (going invalid => valid).

However, one of those invalidations might be inconvenient for the
listener. GtkImage for example does not like receiving
invalidate-contents signals when new contents are assigned, but is fine
with them when the old ones go invalid. And it will not try to draw the
paintable in between anyway.

So by bypassing the 2nd emission if nothing was changed, we can make
GtkImage happy.
gtk/gtkwidget.c
gtk/gtkwidgetpaintable.c
gtk/gtkwidgetpaintableprivate.h [new file with mode: 0644]